package web;

import java.util.ArrayList;
import java.util.Hashtable;

import charts.LineChart;
import charts.PieChart;
import charts.Point;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.Preparable;

@SuppressWarnings("unchecked")
public class TrendAction implements Preparable {
	public String genTrends() {
		System.out.println("generate trends");

		// 画饼图
//		Hashtable<String, Double> gender_percentage = new Hashtable<String, Double>();
//		gender_percentage.put("type1", 1);
//		gender_percentage.put("type2", 2);
//		gender_percentage.put("type3", 6);
//		gender_percentage.put("type4", 9);

		// 画折线图
		ArrayList<Point> points = new ArrayList<Point>();
		Point point1 = new Point(1, 5);
		Point point2 = new Point(2, 10);
		Point point3 = new Point(3, 8);
		Point point4 = new Point(4, 2);
		Point point5 = new Point(5, 7);
		Point point6 = new Point(6, 2);
		Point point7 = new Point(7, 10);
		Point point8 = new Point(8, 3);
		Point point9 = new Point(9, 1);
		Point point10 = new Point(10, 4);

		points.add(point1);
		points.add(point2);
		points.add(point3);
		points.add(point4);
		points.add(point5);
		points.add(point6);
		points.add(point7);
		points.add(point8);
		points.add(point9);
		points.add(point10);

		// ArrayList<Point> points2 = new ArrayList<Point>();
		// point1 = new Point(1, 2);
		// point2 = new Point(2, 7);
		// point3 = new Point(3, 9);
		//
		// points2.add(point1);
		// points2.add(point2);
		// points2.add(point3);

		return Action.SUCCESS;
	}

	public void prepare() throws Exception {
		// if (id != null)
		// employee = service.find(id);
	}

}